package com.gimhon.login.repository.dao;

import com.gimhon.login.entity.User;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;
import java.util.List;

@Repository
public class JdbcTest {
    @Resource
    JdbcTemplate jdbcTemplate;

    public List<User> findAllUser() {
        String sql = "SELECT USER_ID,USERNAME FROM USER";
        List<User> list = jdbcTemplate.query(sql, new Object[]{}, new BeanPropertyRowMapper<User>(User.class));
        return list;
    }
}
